class Solution {
public:
    vector<vector<bool>> labeled;
    int countBattleships(vector<vector<char>>& board) {
        bool labeled[board.size()][board[0].size()];
        int result = 0;
        for(int i = 0; i < board.size(); i++)
            for(int j = 0; j < board[0].size(); j++)
                if (board[i][j] == 'X')
                {
                    labeled[i][j] = false;
                    if ((i != 0 && board[i - 1][j] == 'X') || (j != 0 && board[i][j - 1] == 'X'))
                        continue;
                    result ++;
                }
        return result;
    }
};
